package com.fastCms.customer.friend.controller;

import com.fastCms.business.bim.pojo.vo.DataProdVO;
import com.fastCms.business.bim.pojo.vo.UserBoxVO;
import com.fastCms.business.frame.pojo.PageParam;
import com.fastCms.business.frame.pojo.po.IdPO;
import com.fastCms.business.frame.response.ApiResponse;
import com.fastCms.business.frame.response.ResponseUtil;
import com.fastCms.business.friend.pojo.po.UserBoxPO;
import com.fastCms.business.friend.service.UserBoxService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * <p>
 * 用户盲盒 前端控制器
 * </p>
 *
 * @author liusq
 * @since 2024-04-28
 */
@Controller
@RequestMapping("api/usrBox")
@Api(value = "ApiUserBoxController", tags = "C端-信息盲盒")
public class ApiUserBoxController {

    @Autowired
    private UserBoxService userBoxService;

    @PostMapping("/create")
    @ApiOperation(value = "盲盒列表", notes = "")
    public ApiResponse<PageInfo<UserBoxVO>> create(@RequestBody PageParam<UserBoxPO> param) {
        PageInfo<DataProdVO> result = userBoxService.showPage(param);
        return ResponseUtil.success(result);
    }

    @PostMapping("/showPage")
    @ApiOperation(value = "盲盒列表", notes = "")
    public ApiResponse<PageInfo<UserBoxVO>> showPage(@RequestBody PageParam<UserBoxPO> param) {
        PageInfo<DataProdVO> result = userBoxService.showPage(param);
        return ResponseUtil.success(result);
    }

    @PostMapping("/view")
    @ApiOperation(value = "查看盲盒", notes = "")
    public ApiResponse<UserBoxVO> view(@RequestBody IdPO param) {
        UserBoxVO result = userBoxService.view(param);
        return ResponseUtil.success(result);
    }

//    @PostMapping("/buy")
//    @ApiOperation(value = "购买盲盒", notes = "")
//    public ApiResponse<Boolean> buy(@RequestBody IdPO param) {
//        PageInfo<DataProdVO> result = userBoxService.buy(param);
//        return ResponseUtil.success(result);
//    }


}

